package com.ihr360.payroll.model.dto.salary.plan;


import com.ihr360.payroll.model.dto.salary.plan.idclass.SalaryPlanStaffId;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 薪资方案和员工的中间表，为了能够在薪资方案中禁用员工设计这个中间表
 */
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "salaryplan_staff")
@IdClass(SalaryPlanStaffId.class)
public class SalaryPlanStaff{

    public static final class StaffState {
        /**
         * 员工在薪资方案中的状态标志：
         * NORMAL：正常
         * TEMP_REMOVE：临时删除（在关账之后，这部分员工的状态要从临时删除变回到正常）
         * TEMP_ADD：临时添加（在关账之后，这部分员工要从方案中清除）
         */
        public static final int NORMAL = 1;
        public static final int TEMP_REMOVE = 2;
        public static final int TEMP_ADD = 4;
    }

    @Id
    private Long salaryPlanId;
    @Id
    @Column(length = 40, nullable = false, unique = false)
    private String staffId;

    @Column(columnDefinition = "bool default true")
    private boolean enabled;

    /**
     * 工资单
     */
    @Column
    private Long paySlipConfigId;

    @Column(nullable = false, columnDefinition = "int default 1")
    private int staffState = StaffState.NORMAL;

    public SalaryPlanStaff(Long salaryPlanId, String staffId, boolean enabled, int staffState) {
        this.salaryPlanId = salaryPlanId;
        this.staffId = staffId;
        this.enabled = enabled;
        this.staffState = staffState;
    }

    public Long getSalaryPlanId() {
        return salaryPlanId;
    }

    public void setSalaryPlanId(Long salaryPlanId) {
        this.salaryPlanId = salaryPlanId;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public int getStaffState() {
        return staffState;
    }

    public void setStaffState(int staffState) {
        this.staffState = staffState;
    }

    public Long getPaySlipConfigId() {
        return paySlipConfigId;
    }

    public void setPaySlipConfigId(Long paySlipConfigId) {
        this.paySlipConfigId = paySlipConfigId;
    }
}